home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
fish
/
001-100
/
001-025
/
020
/
speechterm
/
readme
< prev
next >
Wrap
Text File
|
1995-03-17
|
8KB
|
149 lines
term - a terminal emulator.
A few comments
--------------
The files term.c gr.c and speech.c contain the sources for a
terminal emulator for the amiga.
This terminal emulator has several features. This a sort
description:
1) ANSI protocol. This terminal uses the amiga's ANSI
capabilities (see Developer's manual for details). It gives you
25 lines by 80 columns. A unix termcap entry can be found in the
file termcap (in this posting). It assumes 1200 baud and it has
no problem of keeping up with this rate (it does buffered I/O, in
that it doesn't print anything, as long as the host keeps
sending).
2) XMODEM file transfer. You can send a file to a host or get one
from the host using the XMODEM protocol. It works ok, and I have
seen it recovering from line noise. I have only tried it with
text files (not with binaries).
3) Graphics. You can get a picture from your host to your amiga.
You need of course a program on the host to send the appropriate
sequences. The program understands only 3 commands: set color,
draw line, and terminate :-). There are many more that can be
added (most notably mouse commands). In fact what I use has one
more command: draw polygon (possibly filled). The reason I have
removed it is that the source I used for that belongs to
Princeton University. I guess you can add your own code (I have
left the part of the source that understands the polygon command,
so all you need to do is add your own. See function Graphics at
the end of file term.c). The reason I didn't do it yet, is
because my source does some clipping and I don't know how to do
this yet (remember I just got my manuals and they are BIG! :-)).
The program as it is assumes high resolution - interlaced mode
(640 x 400) pixels.
4) Speech. Well, the speech option is simple: it 'reads out loud'
everything between a control A and the first non-printable
character. So, to make it read a file, preceed every line by a
control A. You can switch the speech option on and off. What I
really like is to play hack with this!! It's fun! To do this
instead of the the amiga entry, use the amiga-s entry. Then you
will get to hear things like: you hit the kobolt, or you die!! It
slows down the game but its fun, and you can always turn the
speech option off. I have included a file called say.c that you
can install on your host and then use it to make your amiga talk.
How to use the program
----------------------
To create the executable do a cc term.c gr.c speech.c -o term, or
use the makefile supplied. Under Lattice 3.02 everything should
work ok, (but you will of course get the usual warnings!! :-) ).
To run the program type term (or whatever you want to call it).
The program should start by opening a window, with no borders.
The borders are there, but by printing the appropriate escapes I
get to use the whole screen for text. The prompt term: should
appear. You are in the offline mode. press the help key to get a
listing of all the commands. Type on. You are now in the online
mode. If everything is ok, you should now be able to talk to
whatever is at the other end of the serial port. To return to the
offline mode, press the function key 7 (don't ask why 7, I don't
have a logical explanation :-)). You should get an offline
message, but note that this is temporary. You can only execute
one command on the amiga, then the program will automatically
return you to the online mode. This is useful for executing
commands like sb or rb that transfer files. To stay to the
offline mode type off. To exit the program, first get to offline
mode (f7 then type off) and then type end. You should note that
you can give any command from offline. The program 'executes'
them (this of course does not work with cd). There is one bug, in
that the program may crash when you try to go to offline mode,
but this happens very very rarely.
To use the XMODEM commands, get to online mode, give the
appropriate command to your host, then press f7 and give the
corresponding command to the amiga. So, if say that you want to
send something to the host, get to online, type rb filename, then
press f7 and type sb df1:filename or whatever. The program should
then start transfering your file. At the same time it will print
a count of blocks transfered. You do need of course XMODEM
commands on your host. There are a couple of bugs. When receiving
a file, the last line contains garbage. You need to edit the file
and remove it. When sending a file, the file contains some nulls.
If your host runs unix, just enter vi and do a w!.
The graphics option works like this: to draw a picture on the
amiga, first send an escape G. This gets you in graphics mode.
Everything that comes after this must be a graphics sequence. The
implemented sequences are: T0 which exits the graphics mode, C %d
%d %d %d\n that sets the color (C pennum r g b, where pennum the
pen number, and r g b the rgb coefficients), and L %d %d %d %d
%d\n to draw a line (L x1 y1 x2 y2 pennum, where pennum the pen
number). The parser understands also the command P %d %d %d %d
%d %d %d\n that draws a polygon possibly filled (P num_of_points
pennum clip xmin ymin xmax ymax, where clip is a flag of whether
to clip or not and xmin .. are the clip boundaries). After this
command you must supply the points on the polygon, each on a
separate line (%d %d\n. I didn't include the source for this
routine, for the reasons I mentioned before.
When the escG is received the program opens a screen (640 x 400),
and starts drawing on it according to the incomming commands.
When it finishes, the menu strip that wasn't visible up to now
comes up. To return to the text window, drag this screen down or
send it back. What I chose to do is not to delete the screen when
it finishes. Instead it stays around until you try to end the
program. This way you can keep your picture for as long as you
want, and maybe print it out using a screen dump program that was
posted some time ago. If you want draw a new picture however, and
since I forgot to add a clear screen command :-), you must go to
offline mode and type gfxoff which will delete the screen. If
while in graphics mode you want to abort the drawing, press the
menu button on the mouse and then select the quit option from the
menu. The menu still works even when not visible. Then get back
to the text screen and do whatever necessary to stop the host
from sending the graphics sequences. Since the program does
handshaking you'll probably need to press control Q first, to get
your host to continue. You should make sure that the host sends
the correct sequences, although a character out of place (line
noise) will usually destroy just a small part of the picture. (My
problem is that the graphics packages I use initialize the screen
even when I give a command like: foo | amiga, where amiga is my
filter and foo is a non-existent command. In this case the
program will hung.
The sound option is easy. Just preceed everything you want 'read'
by a control A.
Acknowledgments
---------------
As I mentioned before, this program uses parts (and bugs :-))
from a few other programs. The basic program comes from the myCLI
program of Mike Schwartz. I modified that to get a 25 x 80
screen. I then added the XMODEM transfer routines that were
posted by Michael Mounier, as part of his terminal program. I
used the sparks demo by Scott Ballantyne to get an idea of how
the graphics work. Finally I used Rob Peck's program speech, to
add the speech option. Thanks for the help! (If only it hadn't
taken Commodore all these months to give me my manuals! :-( ).